package com.yzjs.config;


import com.yzjs.base.BestPayServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.stereotype.Component;

@Component
@EnableConfigurationProperties({WxNativeProperties.class})
public class BestPayConfig {

    @Autowired
    private WxNativeProperties wxNativeProp;



    @Bean
    public BestPayServiceImpl bestPayService(){
        BestPayServiceImpl payService = new BestPayServiceImpl();
        payService.setWxPayConfig(wxPayConfig());
        return payService;
    }

    @Bean
    public WxPayConfig wxPayConfig(){
        WxPayConfig wxPayConfig = new WxPayConfig();
        wxPayConfig.setAppId(wxNativeProp.getAppId());
        wxPayConfig.setMchId(wxNativeProp.getMchId());
        wxPayConfig.setMchKey(wxNativeProp.getMchKey());
        wxPayConfig.setNotifyUrl(wxNativeProp.getNotifyUrl());
        wxPayConfig.setReturnUrl(wxNativeProp.getReturnUrl());
        wxPayConfig.setKeyPath(wxNativeProp.getKeyPath());
        return wxPayConfig;
    }


}
